package org.james.deleter.task;

import org.apache.commons.lang3.StringUtils;
import org.james.deleter.utils.FileOperater;

import javafx.concurrent.Task;

public class FileHandleTask extends Task<String> {

	private String type = null;
	private String folder = null;
	private String extensions = null;
	
	public FileHandleTask(String type,String folder,String extensions) {
		this.type = type;
		this.folder = folder;
		this.extensions = extensions;
	}

	@Override
	protected String call() throws Exception {
		if(StringUtils.equals("1", type)){
			FileOperater.deleteFileByExtensions(folder, extensions);
		}
		return null;
	}

}
